package com.client.eurekaclient.controller;

import com.bean.TestBean;
import com.feign.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class ServerController {

    @Autowired
    private TestService testService;

    @RequestMapping(value = "/test/list", method = RequestMethod.GET)
    public List<Map> list() {
        return testService.list();
    }

    @RequestMapping(value = "/test/send", method = RequestMethod.GET)
    public String send() {
        return testService.send("hello word", 1L);
    }

    @RequestMapping(value = "/test/send1", method = RequestMethod.GET)
    public String send1() {
        TestBean testBean = new TestBean();
        testBean.setId(1 + "");
        testBean.setName("111");
        testBean.setData(new ArrayList<>());
        testBean.getData().add("!");
        return testService.send1(testBean);
    }

    @RequestMapping(value = "/test/info", method = RequestMethod.GET)
    public String info() {
        return testService.info();
    }
}
